package com.pstreets.lwuit.demo.widgets;


import com.sun.lwuit.Command;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import com.sun.lwuit.animations.CommonTransitions;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
import javax.microedition.midlet.MIDlet;

/**
 * @author james
 */
public class BidiDemo extends MIDlet {

    public void startApp() {
        
        //init the LWUIT display
        Display.init(this);
        
        //setting the application theme
        try{
            Resources r=Resources.open("/LWUITtheme.res");
            UIManager.getInstance()
                    .setThemeProps(r.getTheme
                    (r.getThemeResourceNames()[0]));
        }catch (Exception e){}
        
        UIManager.getInstance().getLookAndFeel().setRTL(true);
        
        // 1. Create a Form
        Form mainForm = new Form("Form Title");
        // 2. Set LayoutManager
        mainForm.setLayout(new BorderLayout());
        // 3. Add a Label to the center of Form content pane
        mainForm.addComponent(BorderLayout.CENTER, new Label("Form Demo"));
        // 4. Set Transitions animation of Fade
        mainForm.setTransitionOutAnimator(CommonTransitions.createFade(400));
        // 5. Add Command key
        mainForm.addCommand(new Command("Left soft key", 2));
        mainForm.addCommand(new Command("Right Soft key", 2));
        // 6. Show it
        mainForm.show();
        
    
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
}
